import java.util.Arrays;

public class SolutionInterview17_4 {
    public int missingNumber(int[] nums) {
        return nums.length*(nums.length+1)/2- Arrays.stream(nums).sum();
    }

    public static void main(String[] args) {
        System.out.println(new SolutionInterview17_4().missingNumber(new int[]{3,0,1}));
    }
}
